package com.wenx.common;

import java.util.*;

/**
 * Created by wenx on 2019-12-02 16:11
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<String> list = new ArrayList();
        while(sc.hasNext()){
            String str = sc.nextLine();
            if(null == str)
                break;
            list.add(str);
        }
//        String str1 = sc.nextLine();
//        String str2 = sc.nextLine();
//        list.add(str1);
//        list.add(str2);
        //list.forEach(System.out::println);
        Map<String,List<String>> map = new HashMap();
        list.stream()
                .forEach(str -> {
                    StringBuffer nyrbufer = new StringBuffer();
                    String[] times = str.split(" ");
                    //年月日
                    String nyr = times[0];
                    //按照-区分
                    String[] nyrAttr = nyr.split("-");
                    nyrbufer.append(nyrAttr[0])
                            .append(nyrAttr[1])
                            .append(nyrAttr[2]);
                    //时分秒
                    String sfm = times[1];
                    //先按照：分割
                    String[] sfmAttr = sfm.split(":");
                    //对m按照.区分
                    String second = sfmAttr[2];
                    String[] lmAttr = second.split(".");
                    //拼接
                    StringBuffer sfmbufer = new StringBuffer();
                    sfmbufer.append(sfmAttr[0])
                            .append(sfmAttr[1])
                            .append(sfmAttr[2]);
                    Object nyrObject = map.get(nyrbufer);
                    if(nyrObject == null) {
                        List<String> list1 = new ArrayList();
                        list1.add(sfmbufer.toString());
                        map.put(nyrbufer.toString(),list1);
                    } else {
                        List list2 = (List)nyrObject;
                        list2.add(sfmbufer.toString());
                    }
                });
        //.forEach(System.out::println);
        List<Integer> resultList = new ArrayList();
        map.forEach((k,v) -> {
            List<String> lists = (List)v;
            int dayCount = 0;
            String minDay = null;
            Collections.sort(lists);
            for (String str : lists) {
                if(null == minDay) {
                    dayCount ++;
                    minDay = str;
                } else {
                    if (str.equals(minDay)) {
                        dayCount ++;
                    }
                }
            }
            resultList.add(dayCount);
        });
        int sum = resultList.stream()
                .mapToInt(Integer::intValue)
                .sum();
        System.out.println(sum);
    }
}